Geo.Core.OnAfterInitialize.add(function () {
    if(Geo.Core.Current.PrivateKey === null) {
        Geo.Core.Navigation.GoToAction();
        return;
    }
    $('#btnMoved').bind('click', function () {
        if(Geo.Core.Current.LogEntryLid) {
            Geo.Core.Current.ActionType = Geo.Enumerations.ActionTypes.Travel;
            Geo.Core.LogEntryRepository.Update(Geo.Core.Current);
            Geo.Core.Navigation.GoToEntry();
        } else {
            Geo.Core.Navigation.GoToActionDetail(Geo.Enumerations.ActionTypes.Travel);
        }
        return false;
    });
    $('#btnPickUp').bind('click', function () {
        if(Geo.Core.Current.LogEntryLid) {
            Geo.Core.Current.ActionType = Geo.Enumerations.ActionTypes.PickUp;
            Geo.Core.LogEntryRepository.Update(Geo.Core.Current);
            Geo.Core.Navigation.GoToEntry();
        } else {
            Geo.Core.Navigation.GoToActionDetail(Geo.Enumerations.ActionTypes.PickUp);
        }
        return false;
    });
    $('#btnDropOff').bind('click', function () {
        if(Geo.Core.Current.LogEntryLid) {
            Geo.Core.Current.ActionType = Geo.Enumerations.ActionTypes.DropOff;
            Geo.Core.LogEntryRepository.Update(Geo.Core.Current);
            Geo.Core.Navigation.GoToEntry();
        } else {
            Geo.Core.Navigation.GoToActionDetail(Geo.Enumerations.ActionTypes.DropOff);
        }
        return false;
    });
    $('#btnBack').bind('click', function () {
        Geo.Core.Navigation.GoToEntry();
        return false;
    });
    if(Geo.Core.Current.IsOnline) {
        $('#btnSkipLogging').bind('click', function () {
            Geo.Core.Navigation.GoToView();
            return false;
        });
    } else {
        $('#btnSkipLogging').hide();
    }
});
